#include "stdafx.h"
#include "OpenGLExtensions.h"

	// =======================================
	// GL_ARB_multitexture
	// =======================================
	PFNGLACTIVETEXTUREARBPROC glActiveTextureARB = 0;
	PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARB = 0;
	PFNGLMULTITEXCOORD1DARBPROC glMultiTexCoord1dARB = 0;
	PFNGLMULTITEXCOORD1DVARBPROC glMultiTexCoord1dvARB = 0;
	PFNGLMULTITEXCOORD1FARBPROC glMultiTexCoord1fARB = 0;
	PFNGLMULTITEXCOORD1FVARBPROC glMultiTexCoord1fvARB = 0;
	PFNGLMULTITEXCOORD1IARBPROC glMultiTexCoord1iARB = 0;
	PFNGLMULTITEXCOORD1IVARBPROC glMultiTexCoord1ivARB = 0;
	PFNGLMULTITEXCOORD1SARBPROC glMultiTexCoord1sARB = 0;
	PFNGLMULTITEXCOORD1SVARBPROC glMultiTexCoord1svARB = 0;
	PFNGLMULTITEXCOORD2DARBPROC glMultiTexCoord2dARB = 0;
	PFNGLMULTITEXCOORD2DVARBPROC glMultiTexCoord2dvARB = 0;
	PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARB = 0;
	PFNGLMULTITEXCOORD2FVARBPROC glMultiTexCoord2fvARB = 0;
	PFNGLMULTITEXCOORD2IARBPROC glMultiTexCoord2iARB = 0;
	PFNGLMULTITEXCOORD2IVARBPROC glMultiTexCoord2ivARB = 0;
	PFNGLMULTITEXCOORD2SARBPROC glMultiTexCoord2sARB = 0;
	PFNGLMULTITEXCOORD2SVARBPROC glMultiTexCoord2svARB = 0;
	PFNGLMULTITEXCOORD3DARBPROC glMultiTexCoord3dARB = 0;
	PFNGLMULTITEXCOORD3DVARBPROC glMultiTexCoord3dvARB = 0;
	PFNGLMULTITEXCOORD3FARBPROC glMultiTexCoord3fARB = 0;
	PFNGLMULTITEXCOORD3FVARBPROC glMultiTexCoord3fvARB = 0;
	PFNGLMULTITEXCOORD3IARBPROC glMultiTexCoord3iARB = 0;
	PFNGLMULTITEXCOORD3IVARBPROC glMultiTexCoord3ivARB = 0;
	PFNGLMULTITEXCOORD3SARBPROC glMultiTexCoord3sARB = 0;
	PFNGLMULTITEXCOORD3SVARBPROC glMultiTexCoord3svARB = 0;
	PFNGLMULTITEXCOORD4DARBPROC glMultiTexCoord4dARB = 0;
	PFNGLMULTITEXCOORD4DVARBPROC glMultiTexCoord4dvARB = 0;
	PFNGLMULTITEXCOORD4FARBPROC glMultiTexCoord4fARB = 0;
	PFNGLMULTITEXCOORD4FVARBPROC glMultiTexCoord4fvARB = 0;
	PFNGLMULTITEXCOORD4IARBPROC glMultiTexCoord4iARB = 0;
	PFNGLMULTITEXCOORD4IVARBPROC glMultiTexCoord4ivARB = 0;
	PFNGLMULTITEXCOORD4SARBPROC glMultiTexCoord4sARB = 0;
	PFNGLMULTITEXCOORD4SVARBPROC glMultiTexCoord4svARB = 0;

	// =======================================
	// GL_EXT_vertex_array
	// =======================================
	PFNGLARRAYELEMENTEXTPROC glArrayElementEXT = 0;
	PFNGLCOLORPOINTEREXTPROC glColorPointerEXT = 0;
	PFNGLDRAWARRAYSEXTPROC glDrawArraysEXT = 0;
	PFNGLEDGEFLAGPOINTEREXTPROC glEdgeFlagPointerEXT = 0;
	PFNGLGETPOINTERVEXTPROC glGetPointervEXT = 0;
	PFNGLINDEXPOINTEREXTPROC glIndexPointerEXT = 0;
	PFNGLNORMALPOINTEREXTPROC glNormalPointerEXT = 0;
	PFNGLTEXCOORDPOINTEREXTPROC glTexCoordPointerEXT = 0;
	PFNGLVERTEXPOINTEREXTPROC glVertexPointerEXT = 0;

	// =======================================
	// WGL_EXT_extensions_string
	// =======================================
	PFNWGLGETEXTENSIONSSTRINGEXTPROC wglGetExtensionsStringEXT = 0;

//-----------------------------------------------------------------------------
// constructors
//-----------------------------------------------------------------------------
COpenGLExtensions::COpenGLExtensions()
{
}

//-----------------------------------------------------------------------------
// destructors
//-----------------------------------------------------------------------------
COpenGLExtensions::~COpenGLExtensions()
{
}

//-----------------------------------------------------------------------------
// functions
//-----------------------------------------------------------------------------

void COpenGLExtensions::GetExtensions()
{
	// Get all the hardware information

	m_strCompany = glGetString(GL_VENDOR);
	m_strRenderer = glGetString(GL_RENDERER);
	m_strVersion = glGetString(GL_VERSION);
	m_strExtensions = glGetString(GL_EXTENSIONS);

	// Check for the function to return all wgl extensions

	if (wglGetProcAddress("wglGetExtensionsStringEXT") != 0)
	{
		wglGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC) wglGetProcAddress("wglGetExtensionsStringEXT");
		m_strWGLExtensions = wglGetExtensionsStringEXT();
	}

	// =======================================
	// GL_EXT_vertex_array
	// =======================================

	if (m_strExtensions.Find("GL_EXT_vertex_array") != -1)
	{
		glArrayElementEXT =	(PFNGLARRAYELEMENTEXTPROC) wglGetProcAddress("glArrayElementEXT");
		glColorPointerEXT =	(PFNGLCOLORPOINTEREXTPROC) wglGetProcAddress("glColorPointerEXT");
		glDrawArraysEXT = (PFNGLDRAWARRAYSEXTPROC) wglGetProcAddress("glDrawArraysEXT");
		glEdgeFlagPointerEXT = (PFNGLEDGEFLAGPOINTEREXTPROC) wglGetProcAddress("glEdgeFlagPointerEXT");
		glGetPointervEXT = (PFNGLGETPOINTERVEXTPROC) wglGetProcAddress("glGetPointervEXT");
		glIndexPointerEXT = (PFNGLINDEXPOINTEREXTPROC) wglGetProcAddress("glIndexPointerEXT");
		glNormalPointerEXT = (PFNGLNORMALPOINTEREXTPROC) wglGetProcAddress("glNormalPointerEXT");
		glTexCoordPointerEXT = (PFNGLTEXCOORDPOINTEREXTPROC) wglGetProcAddress("glTexCoordPointerEXT");
		glVertexPointerEXT = (PFNGLVERTEXPOINTEREXTPROC) wglGetProcAddress("glVertexPointerEXT");
	}
}